package com.yzg.executors;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author misterWei
 * @create 2020年06月13号:02点32分
 * @mailbox forcontinue@163.com
 */
@Slf4j(topic = "c.CachedMain")
public class CachedMain {

    /**
     * 救急线程的无限创建
     * @param args
     */
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newCachedThreadPool();
        executorService.execute(()->{
            try {
                Thread.sleep(1000L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            log.error("1");
        });
        executorService.execute(()->{
            try {
                Thread.sleep(1000L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            log.error("1");
        });

    }
}
